import { exInput, exRadioGroup, exSwitch, exSelectAllowCreate } from '@ve/common/components/extension'
import { exInputNumber } from '../../extension/index'
export default {
  VERSION: '20220624',
  type: 'uiFunnelChart',
  name: '柱状图',
  icon: 'bar-chart-fill',
  //扩展
  extension: {
    title_show: exSwitch('是否显示标题', true),
    title_text: exInput('图表标题', '标题'),
    title_left: exSelectAllowCreate(
      '标题横向位置',
      'center',
      [
        {
          value: 'left',
          label: '左',
        },
        {
          value: 'center',
          label: '中',
        },
        {
          value: 'right',
          label: '右',
        },
      ],
      '标题横向位置,可自定义'
    ),
    title_top: exSelectAllowCreate(
      '标题纵向位置',
      'top',
      [
        {
          value: 'top',
          label: '上',
        },
        {
          value: 'middle',
          label: '中',
        },
        {
          value: 'bottom',
          label: '下',
        },
      ],
      '标题纵向位置,可自定义'
    ),
    tooltip: {
      type: 'exSwitchToolTip',
      name: '配置提示框',
      value: {
        show: true,
        trigger: 'item',
        triggerOn: 'mousemove',
        showDelay: 0,
        hideDelay: 100,
        backgroundColor: '#fff',
        borderColor: '#fff',
        borderWidth: 0,
        padding: 5,
        textStyle: {
          color: '#888',
          fontSize: 14,
          fontWeight: 'normal',
        },
        formatter: '{a}:<br>{b}:{c}',
      },
    },
    legend_show: exSwitch('显示图例', true),
    legend_textStyle_color: {
      type: 'exSetChartColor',
      name: '颜色配置',
      value: '#000',
    },
    legend_orient: exRadioGroup('图例组件方向', 'vertical', [
      {
        value: 'horizontal',
        label: '横',
      },
      {
        value: 'vertical',
        label: '竖',
      },
    ]),
    legend_type: exRadioGroup('图例展示类型', 'scroll', [
      {
        value: 'scroll',
        label: '分页',
      },
      {
        value: 'plain',
        label: '全部展示',
      },
    ]),
    legend_left: exSelectAllowCreate(
      '图例组件横向位置',
      'left',
      [
        {
          value: 'left',
          label: '左',
        },
        {
          value: 'center',
          label: '中',
        },
        {
          value: 'right',
          label: '右',
        },
      ],
      '图例组件横向位置，可自定义'
    ),
    legend_top: exSelectAllowCreate(
      '图例组件纵向位置',
      'top',
      [
        {
          value: 'top',
          label: '上',
        },
        {
          value: 'middle',
          label: '中',
        },
        {
          value: 'bottom',
          label: '下',
        },
      ],
      '图例组件纵向位置,可自定义'
    ),
    legend_icon: exSelectAllowCreate(
      '图例图形',
      'rect',
      [
        {
          value: 'rect',
          label: '方形',
        },
        {
          value: 'circle',
          label: '圆形',
        },
        {
          value: 'roundRect',
          label: '圆角方形',
        },
        {
          value: 'triangle',
          label: '三角形',
        },
        {
          value: 'diamond',
          label: '菱形',
        },
        {
          value: 'pin',
          label: '大头针',
        },
        {
          value: 'arrow',
          label: '箭头',
        },
      ],
      '可自定义,格式image://图片链接'
    ),
    legend_formatter: exInput('格式化数据', ''),
    legend_itemWidth: exInputNumber('图例图形宽', 10, 1, 100),
    legend_itemHeight: exInputNumber('图例图形高', 10, 1, 100),
    legend_textStyle_fontSize: exInput('字体大小', 10),
    color: {
      type: 'exChartColor',
      name: '颜色配置',
      value: [
        {
          v: '#EE6666',
        },
        {
          v: '#73C0DE',
        },
        {
          v: '#5470C6',
        },
        {
          v: '#91CC75',
        },
        {
          v: '#FAC858',
        },
      ],
    },
    series: {
      type: 'exChartSeries',
      name: '图表配置',
      id: 'bar',
      value: [
        {
          type: 'funnel',
          name: '漏斗图',
          data: [
            { value: 1048, name: 'Search Engine' },
            { value: 735, name: 'Direct' },
            { value: 580, name: 'Email' },
            { value: 484, name: 'Union Ads' },
            { value: 300, name: 'Video Ads' },
          ],
        },
      ],
    },
  },
  //交互
  interaction: [],
  //条件、逻辑指令
  logicInstruction: [],
}
